package com.stlm2.controller.maintain;

import com.stlm2.dems.maintain.entity.Maintain;
import com.stlm2.dems.maintain.service.MaintainService;
import com.stlm2.util.codecontent.CodeContent;
import com.sun.tools.extcheck.Main;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Author：fuchunyu
 * Date：2017/7/27
 * Description：
 */
@Controller
@RequestMapping("/maintainC")
public class MaintainController {

    @Resource
    private MaintainService maintainService;

    @ResponseBody
    @RequestMapping(value = "/getLastMaintain.json",produces="application/json;charset=UTF-8")
    public String getLastMaintain(String companyCode,ModelMap map){
        Maintain maintain=maintainService.getLastVersion();
        if(maintain!=null){
            map=maintainService.buildModel(maintain);
            return CodeContent.returnSuccess(map);
        }else {
            return CodeContent.returnFailure("获取版本升级信息失败！");
        }
    }
}
